public class Main {
    public static int solution(int n, int k) {
        // PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
        // write code here
        int res = 0;
        for (int i = 1; i < n+1; i++ ) {
            res = res + k*i;
        }
        return res;
    }

    public static void main(String[] args) {
        System.out.println(solution(3, 1) == 6);
        System.out.println(solution(2, 2) == 6);
        System.out.println(solution(4, 3) == 30);
    }
}